package hbxz.service;

//import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;

/**
 * @author yhb
 * @date 2021/6/8
 */

@Slf4j
@Service
public class OrderService {

    @Autowired
    private CreditService creditService;
    @Autowired
    private StockService stockService;

    /**
     * 创建订单
     */
    //@Transactional
    //@GlobalTransactional
    public void createOrder() {
        log.info("创建订单");
        // 积分+1
        creditService.creditAdd();
        // 库存-1
        stockService.stockMinus(1);

    }
}
